home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form PrnMix
- BorderStyle = 1 'Fixed Single
- Caption = "Print Profitability Report"
- ControlBox = 0 'False
- Height = 2370
- Icon = PRNMIX.FRX:0000
- Left = 3420
- LinkTopic = "PrnMix"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1965
- ScaleWidth = 2925
- Top = 2325
- Width = 3045
- Begin CommandButton Command1
- Caption = "Cancel"
- Height = 495
- Left = 840
- TabIndex = 0
- Top = 1080
- Width = 1215
- End
- Sub Command1_Click ()
- PrintCancelFlag = True
- End Sub
- Sub Form_Activate ()
- Unload SalesMix
- PrintRoutine
- End Sub
- Sub PrintRoutine ()
- t% = DoEvents()
- On Local Error GoTo ErrorRoutine
- PageNo% = 0
- TotalRetail& = 0
- TotalCost& = 0
- Printer.FontName = RTrim(CfgRec.FontName)
- Printer.FontSize = CfgRec.FontSize
- MaximumY& = (Printer.ScaleHeight - 1500)
- PrintingCancelFlag = False
- Print "Deli Menu System"
- Print "Profitability Report Print"
- Print "Printing...Please Wait..."
- 'Begin First Pass
- 'This pass is to get the totals before printing the report.
- t% = DoEvents()
- FirstSalesMix
- If SalesMixSt% <> 0 Then
- MsgUnknownSalesMixError
- End If
- Do
- ExtCost& = 0
- ExtRetail& = 0
- RecipeCost = 0
- RecipeRec.RecNo = SalesMixRec.RecNo
- ReadRecipe
- 'Get lines of ingredients
- RecipeDetRec.RecDetKey = RecipeRec.RecNo + String$(15, "0")
- GetGERecipeDet
- If RecipeDetSt% <> 9 And RecipeDetSt% <> 0 Then
- MsgUnknownRecipeDetError
- GoTo ExitProgram
- End If
- Do Until RecipeDetSt% <> 0 Or RecipeDetRec.RecDetKey > RecipeRec.RecNo + String$(15, "Z")
- IngredientRec.IngKey = Mid$(RecipeDetRec.RecDetKey, 7, 15)
- ReadIngredient
- If IngredientSt% = 0 Then
- PrIngred$ = Mid$(RecipeDetRec.RecDetKey, 7, 15)
- PrNoUnits# = RecipeDetRec.RecDetQty
- GoSub ProcessOneIngredient
- End If
- t% = DoEvents()
- NextRecipeDet
- Loop
- ExtRetail& = RecipeRec.RecRetail * SalesMixRec.ServingsSold
- UnitCost& = RecipeCost / RecipeRec.Servings
- ExtCost& = UnitCost& * SalesMixRec.ServingsSold
- TotalRetail& = TotalRetail& + ExtRetail&
- TotalCost& = TotalCost& + ExtCost&
- NextSalesMix
- t% = DoEvents()
- Loop Until SalesMixSt% <> 0 Or PrintCancelFlag = True
- DollarProfit@ = (TotalRetail& - (TotalCost& / 100)) / 100
- 'Begin Second Pass
- GoSub PrintHeading
- t% = DoEvents()
- FirstSalesMix
- If SalesMixSt% <> 0 Then
- MsgUnknownSalesMixError
- End If
- Do
- If Printer.CurrentY > MaximumY& Then
- Printer.NewPage
- GoSub PrintHeading
- End If
- ExtCost& = 0
- ExtRetail& = 0
- RecipeCost = 0
- RecipeRec.RecNo = SalesMixRec.RecNo
- ReadRecipe
- 'Get lines of ingredients
- RecipeDetRec.RecDetKey = RecipeRec.RecNo + String$(15, "0")
- GetGERecipeDet
- If RecipeDetSt% <> 9 And RecipeDetSt% <> 0 Then
- MsgUnknownRecipeDetError
- GoTo ExitProgram
- End If
- Do Until RecipeDetSt% <> 0 Or RecipeDetRec.RecDetKey > RecipeRec.RecNo + String$(15, "Z")
- IngredientRec.IngKey = Mid$(RecipeDetRec.RecDetKey, 7, 15)
- ReadIngredient
- If IngredientSt% = 0 Then
- PrIngred$ = Mid$(RecipeDetRec.RecDetKey, 7, 15)
- PrNoUnits# = RecipeDetRec.RecDetQty
- GoSub ProcessOneIngredient
- End If
- t% = DoEvents()
- NextRecipeDet
- Loop
- Printer.Print SalesMixRec.RecNo;
- Printer.Print Tab(8); RecipeRec.RecDesc;
- ExtRetail& = RecipeRec.RecRetail * SalesMixRec.ServingsSold
- Temp1$ = Format$((RecipeRec.RecRetail / 100), "##0.00")
- Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(40); Temp1$;
- UnitCost& = RecipeCost / RecipeRec.Servings
- ExtCost& = UnitCost& * SalesMixRec.ServingsSold
- Temp1$ = Format$((UnitCost& / 10000), "##0.0000")
- Temp1$ = String$(8 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(48); Temp1$;
- Temp1$ = Format$(SalesMixRec.ServingsSold, "####0")
- Temp1$ = String$(5 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(58); Temp1$;
- Temp1$ = Format$((ExtRetail& / 100), "#####0.00")
- Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(65); Temp1$;
- Temp1$ = Format$((ExtCost& / 10000), "#####0.0000")
- Temp1$ = String$(11 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(76); Temp1$;
- Temp1$ = Format$(((ExtRetail& / 100) - (ExtCost& / 10000)), "#####0.00")
- Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(89); Temp1$;
- PctSales@ = (ExtRetail& / TotalRetail&) * 100
- Temp1$ = Format$(PctSales@, "###.00")
- Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(100); Temp1$;
- PctProfit@ = ((ExtRetail& - (ExtCost& / 100)) / (DollarProfit@ * 100)) * 100
- Temp1$ = Format$(PctProfit@, "###.00")
- Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(108); Temp1$
- NextSalesMix
- t% = DoEvents()
- Loop Until SalesMixSt% <> 0 Or PrintCancelFlag = True
- GoSub PrintTotals
- GoTo ExitProgram
- Exit Sub
- PrintHeading:
- PageNo% = PageNo% + 1
- Printer.Print "Projected Sales Mix Profitability Report"; Tab(55); Date$; Tab(85); "Page "; PageNo%
- Printer.Print Tab(66); "Extended Extended Dollar % of % of"
- Printer.Print "Recipe# Description"; Tab(40); "Retail Cost Sold Retail Cost Profit Sales Profit"
- Printer.Print String$(113, "-")
- Return
- ProcessOneIngredient:
- IngredientRec.IngKey = PrIngred$
- ReadIngredient
- CostPerUnit& = IngredientRec.IngCaseCost / IngredientRec.IngUnitsPerCase
- IngredientCost = (CostPerUnit& * PrNoUnits#)
- RecipeCost = RecipeCost + IngredientCost
- Return
- PrintTotals:
- Printer.Print String$(113, "-")
- PctProfit@ = ((TotalRetail& - (TotalCost& / 100)) / TotalRetail&) * 100
- Printer.Print "Total menu profit percent = "; Format$(PctProfit@, "##0.00"); "%";
- Temp1$ = Format$((TotalRetail& / 100), "#####0.00")
- Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(65); Temp1$;
- Temp1$ = Format$((TotalCost& / 10000), "#####0.0000")
- Temp1$ = String$(11 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(76); Temp1$;
- Temp1$ = Format$(DollarProfit@, "#####0.00")
- Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
- Printer.Print Tab(89); Temp1$
- Return
- ErrorRoutine:
- Resume ExitProgram
- ExitProgram:
- Printer.EndDoc
- Unload PrnMix
- End Sub
-